import smtplib
from email.mime.text import MIMEText

def mail(address,content):
    # 发件人邮箱地址
    sendAddress = '1437626743@qq.com'
    # 发件人授权码
    password = 'sabjbdgombngjdhb'
    # 连接服务器
    server = smtplib.SMTP_SSL('smtp.qq.com', 465)
    # 登录邮箱
    loginResult = server.login(sendAddress, password)

    # 正文
    content = content
    # 定义一个可以添加正文的邮件消息对象
    msg = MIMEText(content, 'plain', 'utf-8')

    # 发件人昵称和地址
    msg['From'] = '1437626743@qq.com'
    # 收件人昵称和地址
    msg['To'] = address
    # 邮件主题
    msg['Subject'] = '消息通知'
    address_list = []
    for i in str(address).split(';'):
        address_list.append(i)
    for i in address_list:
      server.sendmail(sendAddress,[i] ,msg.as_string())

if __name__ == "__main__":
    content = "发布失败啦！！！"
    address = "liuzhe@hargent.com;13753705474@163.com"
    print(mail(address, content))